import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

public class Solution710 {

    int n;
    Map<Integer,Integer> map=new HashMap<>();

    public Solution710(int n, int[] blacklist) {
        this.n=n;
        int temp=n-1;
        Arrays.sort(blacklist);
        for (int i=blacklist.length-1;i>=0;i--){
            map.put(blacklist[i],map.getOrDefault(temp,temp));
            temp--;
        }
    }

    public int pick() {
        int num= (int) (Math.random()*(n-map.size()));
        return map.getOrDefault(num, num);
    }

    public static void main(String[] args) {
        Solution710 solution710=new Solution710(7,new int[]{2,3,5});
        System.out.println(solution710.pick());
        System.out.println(solution710.pick());
        System.out.println(solution710.pick());
        System.out.println(solution710.pick());
    }
}
